package com.jxs.android.weixi;

import android.view.LayoutInflater;
import android.view.View;

import com.jxs.android.weiget.FilterViewContent_Common;
import com.jxs.android.weiget.FilterViewCreatedListener;
import com.jxs.android.weiget.LaucherTopBar;
import com.jxs.android.weixi.data.Filter_Data_Common;
import com.telecom.weixi.R;
import com.telecom.weixi.R.array;

public class MyWork_UserDetail_Laucher extends MyLaucher {

	private FilterViewContent_Common contentView;

	@Override
	public void onClick(View v) {
		super.onClick(v);
		if (v.getId() == option_1_ll.getId()) {
			show(direction, MyWork_UserDetail_Laucher_LostUser.class, array.my_work_user_detail);
		} else if (v.getId() == option_2_ll.getId()) {
			show(direction, MyWork_UserDetail_Laucher_Revalue.class, array.my_work_user_detail);
		} else if (v.getId() == option_3_ll.getId()) {
			show(direction, MyDoing.class, array.my_work_user_detail);
		}
	}

	@Override
	public void topBarLogic(final LaucherTopBar topBar) {
		this.topBar = topBar;
		super.topBarLogic(topBar);
		this.topBar.setFilterBtnText(R.string.prompt_filter);
		this.topBar.hindBtn();
		this.topBar.setFilterBtnVisibility(View.VISIBLE);
		initFilterBar(R.layout.bu_my_work_filter_user);
	}

	private void initFilterBar(int layout) {
		contentView = (FilterViewContent_Common) LayoutInflater.from(this).inflate(layout, null);
		contentView.setBtnOnClickListern(new FilterViewContent_Common.BtnOnClickListern() {
			@Override
			public void okLogic() {
				Filter_Data_Common.setConditionAccNbr(contentView.getConditionAccNbr());
				Filter_Data_Common.setConditionAddStock(contentView.getConditionAddStock());
				Filter_Data_Common.setConditionHighValue(contentView.getConditionHighValue());
				Filter_Data_Common.setConditionProduct(contentView.getConditionProduct());
				Filter_Data_Common.setConditionVipClub(contentView.getConditionVipClub());
				Filter_Data_Common.setConditionSortTag(contentView.getConditionSortTag());
				sendConditionFilterBroadCast("1");
				topBar.getFilterBtn().getPopupWindow().dismiss();
			}
			@Override
			public void cancelLogic() {
				topBar.getFilterBtn().getPopupWindow().dismiss();
			}
		});
		this.topBar.setViewAndCreatedListener(contentView, new FilterViewCreatedListener() {

			@Override
			public void onViewCreated(View v) {
			}
		});
	}

	@Override
	public int getSortArrayid() {
		return array.my_work_user_detail;
	}

	@Override
	protected void showView(LaucherDirection direction, int sortArrayid) {

		super.showView(direction, sortArrayid);
		if (direction.ordinal() == LaucherDirection.OPTION_1.ordinal()) {
			show(direction, MyWork_UserDetail_Laucher_LostUser.class, sortArrayid);
		} else if (direction.ordinal() == LaucherDirection.OPTION_2.ordinal()) {
			show(direction, MyWork_UserDetail_Laucher_Revalue.class, sortArrayid);
		} else if (direction.ordinal() == LaucherDirection.OPTION_3.ordinal()) {
			// show(direction, MyWork_UserDetail_Laucher_CareFor.class,
			// sortArrayid);
			show(direction, MyDoing.class, sortArrayid);
		}
	}

	@Override
	protected void initMainView() {
		super.initMainView();
		option_1_tv.setText("流失预警");
		option_2_tv.setText("价值提升");
		option_3_tv.setText("客户关怀");

	}
}
